Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p>Press and hold down a key inside the text field to set a red background color. Release the key to set a green background color.</p> <input type="text" id="demo" onkeydown="keydownFunction()" onkeyup="keyupFunction()"> <script> function keydownFunction() { document.getElementById("demo").style.backgroundColor = "red"; } function keyupFunction() { document.getElementById("demo").style.backgroundColor = "green"; } </script> </body> <!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onkeydown_onkeyup by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 08:29:29 GMT --> </html>
Result:
Try it Yourself - © w3schools.com